import os
from langgraph.prebuilt import create_react_agent

os.environ["OPENAI_API_KEY"] = "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"
api_key = os.environ["OPENAI_API_KEY"]

def get_weather(city: str) -> str:  
    """Get weather for a given city."""
    return f"It's always sunny in {city}!"

agent = create_react_agent(
    model="deepseek/deepseek-chat-v3-0324:free",
    tools=[get_weather],
    prompt="你是一个天气助手",
    api_key=api_key,
    base_url="https://openrouter.ai/api/v1",
)

# Run the agent
agent.invoke(
    {"messages": [{"role": "user", "content": "你好"}]},
    config={"recursion_limit": 10},
    stream=True,
    include_llm_output=True,
    verbose=True,
)